package entity;

import base.IdEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import javax.validation.constraints.Size;

/**
 * @author futao
 * Created on 18-2-5-下午3:06.
 */
@Entity
@Table(name = "futao_user")
@DynamicInsert
@DynamicUpdate
public class User extends IdEntity {

    /**
     * 昵称
     */
    @Column(name = "nick_name", length = 50)
    private String nickName;
    public static final String _nickName = "nickName";

    /**
     * 性别
     * {@link User_Sex}
     */
    @Column(name = "sex")
    @Enumerated(value = EnumType.ORDINAL)
    @Convert(converter = User_Sex_Convert.class)
    private Enum sex;
    public static final String _sex = "sex";

    /**
     * QQ
     */
    @Column(name = "qq", length = 10)
    private String QQ;
    public static final String _qq = "qq";

    /**
     * mobile
     */
    @Column(name = "mobile")
    @Size(max = 50, message = "手机号太长了")
    private String mobile;
    public static final String _mobile = "mobile";


    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    @Override
    public String toString() {
        return "User{" +
                "nickName='" + nickName + '\'' +
                ", sex=" + sex +
                ", QQ='" + QQ + '\'' +
                ", mobile='" + mobile + '\'' +
                '}';
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public Enum getSex() {
        return sex;
    }

    public void setSex(Enum sex) {
        this.sex = sex;
    }

    public String getQQ() {
        return QQ;
    }

    public void setQQ(String QQ) {
        this.QQ = QQ;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
}
